/*
 *  $Id: Constants.cs 1189 2010-11-12 14:40:06Z thenn.erannor $
 *  This file is a part of Ragima CCG.
 *  (C) 2008 Ragima development group.
 *
 *  Licensed under the terms of the GNU GPL License version 2.
 *
 */

using System;
using System.IO;

using AgateLib.Geometry;

using Ragima.Helper;

namespace Ragima {
    public enum TabType {
        Cards,
        Abilities,
        Lands,
        Enchantments,
        Graveyard,
    }

    public static class Constants {
        public const int DisplayWidth = 1024;
        public const int DisplayHeight = 768;
        public readonly static Size DisplaySize = new Size(DisplayWidth, DisplayHeight);
        public const byte MaxAlpha = 255;

        public readonly static TimeSpan FrameTime = TimeSpan.FromMilliseconds(18);

        public static readonly string[] TabIdents = {"cards","abilities","lands","enchantments","graveyard"};

        public const int BigCardWidth = 269;
        public const int BigCardHeight = 263;
        public static readonly Size BigCardSize = new Size(BigCardWidth, BigCardHeight);
        public const int SmallCardWidth = 104;
        public const int SmallCardHeight = 133;
        public static readonly Size SmallCardSize = new Size(SmallCardWidth, SmallCardHeight);

        public const int BigCardFrameWidth = 300;
        public const int BigCardFrameHeight = 434;
        public const int BigCardFramePartHeight = BigCardFrameHeight / 2;
        public static readonly Rectangle BigCardFrameUpperPart = new Rectangle(0, 0, BigCardFrameWidth, BigCardFramePartHeight);
        public static readonly Rectangle BigCardFrameLowerPart = new Rectangle(0, BigCardFramePartHeight, BigCardFrameWidth, BigCardFramePartHeight);

        public const int DiceX = 13;
        public const int DiceY = 501;
        public const int DiceCenterX = 164;
        public const int DiceCenterY = 651;
        public const int DiceEyeX = 10;
        public const int DiceEyeY = 485;
        public const int DiceOverX = 116;
        public const int DiceOverY = 502;
        public const int DiceOverSize = 94;

        public const int PhaseX = 133;
        public const int PhaseY = 667;
        public const int TurnX = 165;
        public const int TurnY = 629;

        public const int LogX = 19;
        public const int LogY = 26;
        public const int LogWidth = 300;
        public const int LogHeight = 434;
        public const int LogScrollX = 292;
        public const int LogScrollY = 28;
        public const int LogScrollHeight = LogHeight-8;
        public const int LogRowHeight = 16;
        public const int LogRows = LogHeight / LogRowHeight;
        public const int LogTextRightIndent = 40;
        public static readonly Rectangle Log = new Rectangle(LogX, LogY, LogWidth, LogHeight);

        public const int HelpDescriptionWidth = 256;

        public const int NoticeX = 329 + (DisplayWidth - 329 - NoticeWidth) / 2;
        public const int NoticeY = 19 + (606 - 19 - NoticeHeight) / 2;
        public const int NoticeWidth = 256;
        public const int NoticeHeight = 64;
        public const int NoticeTextWidth = NoticeWidth - 32;
        public const int NoticeRowHeight = 16;

        public const int GamePhaseX = DiceEyeX + 19;
        public const int GamePhaseY = DiceEyeY + 57;
        public static readonly Point GamePhasePos = new Point(GamePhaseX, GamePhaseY);

        public const int Button1X = DiceEyeX + 19;
        public const int Button1Y = DiceEyeY + 57;
        public const int Button2X = DiceEyeX + 19;
        public const int Button2Y = DiceEyeY + 89;
        public const int Button3X = DiceEyeX + 210;
        public const int Button3Y = DiceEyeY + 57;
        public const int Button4X = DiceEyeX + 210;
        public const int Button4Y = DiceEyeY + 89;
        public const int ButtonWidth = 74;
        public const int ButtonHeight = 23;
        public static readonly Rectangle ButtonEndTurn = new Rectangle(Button3X, Button3Y, ButtonWidth, ButtonHeight);

        public const int TabX = 346;
        public const int TabY = 585;
        public const int TabStep = 96;
        public const int TabWidth = 118;
        public const int TabHeight = 21;

        public const int RowX = 350;
        public const int RowXStep = 110;
        public const int Row1Y = 27;
        public const int Row2Y = 234;
        public const int Row3Y = 440;
        public const int Row4Y = 631;
        public static readonly int[] RowY = {Row1Y, Row2Y, Row3Y, Row4Y};

        public static int GetRowX(int i) { return RowXStep * i + RowX; }
        public static Rectangle GetRowRect(int x, int y) {
            return new Rectangle(new Point(GetRowX(x), RowY[y]), SmallCardSize);
        }

        public static int GetAttackArrowX(int from, int to) {
            return GetRowX(Math.Min(from, to)) + 46;
        }
        public static int GetAttackArrowY(bool dir) { return dir ? 370 : 165; }

        public const int MaxAttackForwardStep = 20;

        public const int Numbers02Height = 10;

        public const int ArrowLeftX = 329;
        public const int ArrowRightX = 1006;
        public const int ArrowY = 625;
        public const int ArrowWidth = 18;
        public const int ArrowHeight = 141;
        public static readonly Rectangle ArrowLeft = new Rectangle(ArrowLeftX, ArrowY, ArrowWidth, ArrowHeight);
        public static readonly Rectangle ArrowRight = new Rectangle(ArrowRightX, ArrowY, ArrowWidth, ArrowHeight);

        public const int ButtonUseX = 2;
        public const int ButtonUseY = 109;
        public const int ButtonUseWidth = 104;
        public const int ButtonUseHeight = 27;

        public const int HealthBar1X = 11;
        public const int HealthBar2X = 221;
        public const int HealthBarY = 748;
        public static readonly Color[] HealthBarColor = {
            0x911010.ToColor(),
            0x375323.ToColor(),
            0x113e75.ToColor()
        };

        public const int Avatar1X = 9;
        public const int Avatar2X = 220;
        public const int AvatarY = 615;
        public const int AvatarSize = 100;
        public const int PlayerNameY = AvatarY + AvatarSize + 11;

        public const int MeditationPoolX = 148;
        public const int MeditationPoolY = 723;
        public const int MeditationPoolSize = 33;
        public static readonly Rectangle MeditationPoolOverlaySrc = new Rectangle(0, 0, MeditationPoolSize, MeditationPoolSize);
        public static readonly Rectangle MeditationPoolOverlayDest = new Rectangle(MeditationPoolX, MeditationPoolY, MeditationPoolSize, MeditationPoolSize);

        public static readonly int[] MeditationX = {148, 166};
        public const int MeditationY = 630;
        public const int MeditationWidth = 15;
        public const int MeditationHeight = 83;
        public static readonly int[] MeditationSrcX = {95, 113};
        public static readonly int[] MeditationOverlaySrcX = {62, 80};
        public const int MeditationSrcY = 45;

        public static readonly int[] MeditationMarkX = {118, 183};
        public const int MeditationMarkY = MeditationY+MeditationHeight-11;
        public const int MeditationMarkWidth = 28;
        public const int MeditationMarkHeight = 20;
        public const int MeditationMarkTextX = 14;
        public const int MeditationMarkTextY = 0;
        public static readonly int[] MeditationMarkSrcX = {100, 66};
        public const int MeditationMarkSrcY = 0;

        public static readonly int[] PlayerManaX = {0, 375, 485, 598, 710, 818, 930};
        public const int PlayerMana1Y = 1;
        public const int PlayerMana2Y = Row4Y-23;

        public static readonly int[] ManaGainLayer1 = {-1, 2, 1, 0, -1};
        public static readonly int[] ManaGainLayer2 = {-1, -1, 2, 1, 0};
        public const int ManaGainWidth = 34;
        public const int ManaGainHeight = 32;
        public static readonly Rectangle[] ManaGainRects = {
            new Rectangle(0, 0, ManaGainWidth, ManaGainHeight),
            new Rectangle(0, ManaGainHeight, ManaGainWidth, ManaGainHeight),
            new Rectangle(0, ManaGainHeight*2, ManaGainWidth, ManaGainHeight)
        };

        public const int MaxDeckSize = 24;
        public const int MaxDeckReserveSize = 6;
        public const int DefaultPlayerHealth = 40;
        public const int DefaultMana = 1;
        public const int MaxMeditation = 20;
        public const int FieldSize = 6;
        public const int StartCardCount = 6;
        public const int MaxOpenedCardCount = 6;
    }
}
